<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>www.topgoer.com验证码</title>
</head>
<body>
    <img src="/auth/captcha" onclick="this.src='/captcha?v='+Math.random()">
    <p>
        验证码：
        <input type="text" id="value">
    </p>
    <p>
        <button id="submit">验证</button>
    </p>
    <p>
        info: <span id="info"></span>
    </p>
</body>
<script src="/assets/js/jquery-3.5.1.min.js"></script>
<script>
    $(function() {
        // json 格式提交
        $('#submit').click(function() {
            $.ajax({
                url: `/auth/captcha/verify/${$('#value').val()}`,
                type: 'get',
                success: function(data) {
                    info.innerHTML = data.msg;
                },
                error: function() {
                    alert('网络错误，请稍后再试');
                }
            });
            return false;
        });
    });
</script>
</html>